#include <iostream>

using namespace std;
class Dog
{
public:
	Dog(int _age,float _weight)
	{
		age=_age;
		weight=_weight;
	}
	Dog()
	{
		
	}
	void show()
	{
		cout<<"age  "<<age<<endl;
	}
	friend Dog operator+(Dog &dog1,Dog &dog2);
private:
	int age;
	float weight;
};

//定义一个普通函数去重载加法运算
Dog operator+(Dog &dog1,Dog &dog2)
{
	//定义临时对象
	Dog temp;
	temp.age=dog1.age+dog2.age;
	return temp;
}
int main()
{
	Dog dog1(5,50.2);
	Dog dog2(4,42.3);
	Dog dog3=operator+(dog1,dog2);
	dog3.show();
	//cout<<dog3<<endl;
}